package com.pinyoumei.app.activity.ShoppingCenter.jd;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.RelativeLayout;

import com.pinyoumei.app.R;
import com.pinyoumei.app.activity.BaseActivity;
import com.pinyoumei.app.adapter.HighCommissionAdapter;
import com.pinyoumei.app.bean.TipBean;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2020-12-18.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2020-12-18        Administrator             新增Person类
 * 2020-12-18        Administrator             增加sex属性
 * 高佣精选
 */
public class HighCommissionActivity extends BaseActivity implements View.OnClickListener {


//    private Banner banner;
    private SmartRefreshLayout swipeRefreshLayout;
    private List<String> image_list = new ArrayList<>();
    private HighCommissionAdapter highCommissionAdapter;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_high_commission);


        initWidget();



        initData();
    }

    private void initWidget() {




        RelativeLayout relativeFinish = findViewById(R.id.relative_finish);
        relativeFinish.setOnClickListener(this);
//        banner = findViewById(R.id.banner2);
        swipeRefreshLayout = findViewById(R.id.swipeRefreshLayout);
        swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {

            }
        });
        swipeRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {

            }
        });
        RecyclerView rv1 = findViewById(R.id.rv_1);
        rv1.setLayoutManager(new LinearLayoutManager(HighCommissionActivity.this,LinearLayoutManager.VERTICAL,false));
        highCommissionAdapter = new HighCommissionAdapter(R.layout.item_jd99_list,null);
        rv1.setAdapter(highCommissionAdapter);
    }

    private void initData() {
        ArrayList<TipBean> tipBeans = new ArrayList<>();
        for (int i = 0; i < 8; i++) {
            TipBean tipBean = new TipBean();
            tipBeans.add(tipBean);
        }
        highCommissionAdapter.setNewData(tipBeans);
    }


//    private void initBanner(List<ToBaoBean.ResultBean.TopBannerListBean> banner_list) {
//        //第一个Banner
//        for (int i = 0; i < banner_list.size(); i++) {
//            image_list.add(banner_list.get(i).getImg_path());
//        }
//        if (image_list.size() == 1) {
//            banner.isAutoPlay(false);//设置默认为不轮播
//
//        } else {
//            banner.isAutoPlay(true);//设置默认为自动轮播
//
//        }
//        banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);//设置Banner的样式BannerConfig.NUM_INDICATOR
//        banner.setImages(image_list); //存放图片的list集合url
//        banner.setBannerAnimation(Transformer.ZoomOutSlide);//设置Banner轮播的动画特效的样式
//        //banner.setPageTransformer(true,)//自定义轮播动画
//        banner.setImageLoader(new GlideImageLoader());//设置图片加载器
//        banner.setDelayTime(3000);//设置轮播间隔时间
//        //设置指示器位置（当banner模式中有指示器时）
//        banner.setIndicatorGravity(BannerConfig.CENTER);
//        banner.start();
//
//        banner.setOnBannerListener(new OnBannerListener() {
//            @Override
//            public void OnBannerClick(int position) {
//                if (banner_list.get(position).getIs_can_link() == 1) {
//
//                    if (banner_list.get(position).getIs_h5() == 1) {
//                        Intent intent = new Intent(HighCommissionActivity.this, WebViewActivity.class);
//                        intent.putExtra("url", banner_list.get(position).getH5_url());
//                        intent.putExtra("order_title", "");
//                        startActivity(intent);
//                    } else {
//                        //跳转
//                        IntentUtils.Intent_to(HighCommissionActivity.this, banner_list.get(position).getMethod_name(),"");
//                    }
//
//                }
//
//
//            }
//        });
//
//    }

    //使用Glide加载器
//    public class GlideImageLoader extends ImageLoader {
//        @Override
//        public void displayImage(Context context, Object path, ImageView imageView) {
//            //Glide 加载图片
//            RequestOptions placeholder = new RequestOptions().placeholder(R.mipmap.ic_error_loading);
//            Glide.with(context).load(path).apply(placeholder).into(imageView);
//        }
//    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.relative_finish:
                finish();
                break;

            default:
                break;
        }
    }
}
